package com.bw.controller;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import com.bw.service.OrderInfoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class OrderInfoController {

    @Autowired
    OrderInfoService orderInfoService;


    @RequestMapping("/findOrderInfo")
    public List<Map> findOrderInfo(){

        return orderInfoService.findOrderInfo();


    }


    @RequestMapping("/edu2")
    public Map edu2(){

        List<Vo1> list=orderInfoService.edu2();

        ArrayList<String> list1 = new ArrayList<>();

        list1.add("来源名称");
        list1.add("订单总额");
        list1.add("下单用户总数");
        list1.add("订单总数");


        return SugarUtil.getTablePlayData(list1,list);
    }

    @RequestMapping("/edu3")
    public Map  endu3(){

        Double  val =orderInfoService.edu3();

        return   SugarUtil.getFlipNumberData(val);


    }


    @RequestMapping("/edu4")
    public Map edu4(){

        List<Vo> list=orderInfoService.edu4();

        ArrayList<String> list2 = new ArrayList<>();

        list2.add("课程名称");
        list2.add("订单金额");


        return SugarUtil.getTablePlayData(list2,list);
    }



    @RequestMapping("/edu1")
    public Map edu1(){

        List<Vo> list=orderInfoService.edu1();


        return SugarUtil.getLineData(list);
    }





}
